"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SystemSettingModel = void 0;
const SystemSettingDao_1 = require("../../gm_server/dao/SystemSettingDao");
const WebVersionModel_1 = require("../../web_server/model/WebVersionModel");
const GameConfig_1 = require("../config/GameConfig");
class SystemSettingModel {
    constructor() {
        this.notice = "test";
        this.customer = "test";
        this.download = "test";
        this.newusersend = 0;
    }
    init() {
        return __awaiter(this, void 0, void 0, function* () {
            let results = yield SystemSettingDao_1.SystemSettingDao.get_all_system_setting();
            // Logger.log("results====", results)
            for (let i = 0; i < results.length; i++) {
                if (results[i]["setting_key"] == GameConfig_1.GameConfig.System_Setting.notice) {
                    this.notice = results[i]["setting_value"];
                }
                else if (results[i]["setting_key"] == GameConfig_1.GameConfig.System_Setting.customer) {
                    this.customer = results[i]["setting_value"];
                }
                else if (results[i]["setting_key"] == GameConfig_1.GameConfig.System_Setting.download) {
                    this.download = results[i]["setting_value"];
                }
                else if (results[i]["setting_key"] == GameConfig_1.GameConfig.System_Setting.newusersend) {
                    this.newusersend = parseInt(results[i]["setting_value"]);
                }
            }
            WebVersionModel_1.WebVersionModel.android_download_url = this.download;
            WebVersionModel_1.WebVersionModel.ios_download_url = this.download;
            // Logger.log("SystemSettingModel====", SystemSettingModel.instance)
        });
    }
}
exports.SystemSettingModel = SystemSettingModel;
SystemSettingModel.instance = new SystemSettingModel();
